"""
URL configuration for mysite2 project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, re_path
from django.views.static import serve
from django.conf import settings

from app01.view import depart, pretty, user, adminInfo, account, task, order, chart, upload

urlpatterns = [
    # path('admin/', admin.site.urls),
    # path('index/', views.index),
    # path('login/', views.login),
    # 设置media为用户上传文件路径
    re_path(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}, name='media'),
    # 管理员登录
    path('login/', account.login),
    # 验证码
    path('img/code/', account.img_code),
    # 管理员注销
    path('logout/', account.logout),
    # 管理员列表
    path('admin/list/', adminInfo.admin_list),
    # 新建管理员
    path('admin/add/', adminInfo.admin_add),
    # 编辑管理员
    path('admin/<int:nid>/edit/', adminInfo.admin_edit),
    # 删除管理员
    path('admin/<int:nid>/delete/', adminInfo.admin_delete),
    # 重置密码
    path('admin/<int:nid>/reset/', adminInfo.admin_reset),
    # 部门列表
    path('depart/list/', depart.depart_list),
    # 新建部门
    path('depart/add/', depart.depart_add),
    # 删除部门
    path('depart/delete/', depart.depart_delete),
    # 编辑部门
    path('depart/<int:nid>/edit/', depart.depart_edit),
    # 用户列表
    path('user/list/', user.user_list),
    # 添加用户
    path('user/add/', user.user_add),
    # 使用modelForm添加用户
    path('user/modelForm/add/', user.user_modelform_add),
    # 使用modelForm编辑用户
    path('user/modelForm/<int:nid>/edit/', user.user_modelform_edit),
    # 使用modelForm删除用户
    path('user/modelForm/<int:nid>/delete/', user.user_modelform_delete),
    # 靓号列表
    path('prettynum/list/', pretty.prettynum_list),
    # 添加靓号
    path('prettynum/add/', pretty.prettynum_add),
    # 编辑靓号
    path('prettynum/<int:nid>/edit/', pretty.prettynum_edit),
    # 删除靓号
    path('prettynum/<int:nid>/delete/', pretty.prettynum_delete),
    # 删除用户
    path('user/delete/', user.user_delete),
    # 任务列表
    path('task/list/', task.task_list),
    # 添加任务
    path('task/add/', task.task_add),
    # 订单列表
    path('order/list/', order.order_list),
    # 新建订单
    path('order/add/', order.order_add),
    # 删除订单
    path('order/delete/', order.order_delete),
    # 编辑订单记录
    path('order/detail/', order.order_detail),
    # 编辑订单保存
    path('order/edit/', order.order_edit),
    # 图表
    path('chart/list/', chart.chart_list),
    # 柱状图
    path('chart/bar/', chart.chart_bar),
    # 饼图
    path('chart/pie/', chart.chart_pie),
    # 折线图
    path('chart/line/', chart.chart_line),
    # 上传图片
    path('upload/list/', upload.upload_list),
    # 上传excel
    path('upload/multi/', upload.upload_multi),
    # modelForm上传
    path('upload/model/form/', upload.upload_modelform),
    # city 列表
    path('city/list/', upload.city_list),
]
